<template>
  <div class="margin-top-40">
      <div class="mui-content">
      <ul class="mui-table-view">
				<li class="mui-table-view-cell mui-media" v-for="(itm,idx) in newsData" :key='idx'>
					<router-link href="javascript:;" :to="'news/list/'+itm.id">
						<img class="mui-media-object mui-pull-left" :src="itm.img_url">
						<div class="mui-media-body">
							<p class='mui-ellipsis'>{{itm.title}}</p>
                            <p>日期{{itm.id|fmtDate('YYYY-MM-DD')}}<span class="fr">点击{{itm.click}}次</span></p>
						</div>
					</router-link>
				</li>
			</ul>
      </div>
  </div>
</template>
<style scoped>
 .fr{
     float: right;
 }
</style>

<script>
    import common from '../../static/common/common.js'
    
    export default{
        data(){
            return {
                newsData:[]
            }
        },
        created(){
            this.newsList()                       
        },
        methods:{
            newsList(){
                const url = common.baseUrl+'api/getnewslist'
                this.$http.get(url).then(res=>{
                    this.newsData = res.body.message 
                },err=>{
                    console.log(err);
                })
            }
        }
    }
</script>